package edu.sctu.zhengsenwen.month201505.day25150505;

/**
 * Created by user15 on 2015/5/5.
 */
public class NarcissisticNumber {
    public static void main(String[] args) {

        System.out.println("All narcissistic numbers from 100~1000:");
        int i;
        for (i = 100; i < 1000; i++) {

            flowers(i);

        }
    }

    public static void flowers(int n) {

        int a;
        int b;
        int c;
        int sum ;
        a = n % 10;
        b = n / 10 % 10;
        c = n / 100;
        sum = a * a * a + b * b * b + c * c * c;
        if (sum == n)
            System.out.println(n + " is a narcissistic number.");
    }
}
